Warning: package 'recipes' was built under R version 4.4.3
Warning: package 'rsample' was built under R version 4.4.3
── Conflicts ───────────────────────────────────────── tidymodels_conflicts() ──
✖ scales::discard() masks purrr::discard()
✖ dplyr::filter() masks stats::filter()
✖ recipes::fixed() masks stringr::fixed()
✖ dplyr::lag() masks stats::lag()
✖ yardstick::spec() masks readr::spec()
✖ recipes::step() masks stats::step()
• Learn how to get started at https://www.tidymodels.org/start/
library(prophet)
Warning: package 'prophet' was built under R version 4.4.3
Loading required package: Rcpp
Attaching package: 'Rcpp'
The following object is masked from 'package:rsample':
populate
Loading required package: rlang
Warning: package 'rlang' was built under R version 4.4.3
Attaching package: 'rlang'
The following objects are masked from 'package:purrr':
%@%, flatten, flatten_chr, flatten_dbl, flatten_int, flatten_lgl,
flatten_raw, invoke, splice
# Data import for: Cache la Poudre River at Mouth (USGS site 06752260)# Bringing in historical (training) data (2013-2023)poudre_hist_flow <-readNWISdv(siteNumber ="06752260", # Download data from USGS for site 06752260parameterCd ="00060", # Parameter code 00060 = discharge in cfs)startDate ="2013-01-01", # Set the start dateendDate ="2023-12-31") %>%# Set the end daterenameNWISColumns() %>%# Rename columns to standard names (e.g., "Flow", "Date")mutate(date =floor_date(Date, "month")) %>%# Convert to first day of each monthgroup_by(date) %>%# Group the data by the new monthly Datesummarize(Flow =mean(Flow, na.rm =TRUE)) %>%# Calculate the monthly average flowungroup()